﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using MyWeb.Business;
namespace MyWeb.Control.Home
{
    public partial class Banner : System.Web.UI.UserControl
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                showbanner();
            }                                
        }
        protected void showbanner()
        {
            List<Data.Advertise> list = AdvertiseService.Advertise_GetByPosition("1");
            if (list.Count > 0)
            {
                for (int i = 0; i < list.Count; i++)
                {
                    ltrbanner.Text += "<div class=\"banner\"><div class=\"advbaner\"><a href=\"/Default.aspx\"><img src=\"" + list[i].Image + "\"  alt=\"" + list[i].Name + "\"/></a></div></div>";
                }
            }
        }
    }
}